package entity;

import constant.ResultConstant;

import java.io.Serializable;


/**
 * 〈一句话功能简述〉<br>
 *
 * @author lz
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
public class ResultBean implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 提示消息
     */
    private String msg = ResultConstant.Msg.SUCCESS;
    /**
     * 状态码
     */
    private int code = ResultConstant.Code.SUCCESS;
    private Long count;

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    /**
     * 数据
     */
    private Object data;

    public ResultBean() {
        super();
    }

    public ResultBean(int code, String msg) {
        super();
        this.msg = msg;
        this.code = code;
    }

    public ResultBean(int code, String msg, Object data) {
        super();
        this.msg = msg;
        this.code = code;
        this.data = data;
    }

    public ResultBean(int code, String msg,Long count, Object data) {
        super();
        this.msg = msg;
        this.code = code;
        this.data = data;
        this.count = count;
    }

    public ResultBean(Object data) {
        super();
        this.data = data;
    }

    public ResultBean(Throwable e) {
        super();
        this.msg = e.toString();
        this.code = ResultConstant.Code.FAIL;
    }

    public ResultBean(Integer num) {
        if (num != null) {
            if (num > 0) {
                return;
            }
        }

        this.msg = ResultConstant.Msg.FAIL;
        this.code = ResultConstant.Code.FAIL;
    }

    /**
     * 
     * 功能描述: <br>
     * 〈成功〉
     *
     * @return
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    public static ResultBean sucess() {
        return new ResultBean();
    }

    /**
     * 
     * 功能描述: <br>
     * 〈成功〉
     *
     * @param msg 提示信息
     * @return
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    public static ResultBean sucess(String msg) {
        return new ResultBean(ResultConstant.Code.SUCCESS, msg);
    }

    /**
     * 
     * 功能描述: <br>
     * 〈失败〉
     *
     * @return
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    public static ResultBean fail() {
        return new ResultBean(ResultConstant.Code.FAIL, ResultConstant.Msg.FAIL);
    }

    /**
     * 
     * 功能描述: <br>
     * 〈失败〉
     *
     * @param msg 提示信息
     * @return
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    public static ResultBean fail(String msg) {
        return new ResultBean(ResultConstant.Code.FAIL, msg);
    }

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
    
}
